DarkOneVenzar
|
Diviner
|
|
|
Reged: 11/04/03
|
Posts: 2774
|
Loc: Realm of Darkness
|
|
|
I would like to make a custom Orc companion but I am not sure of the script I need. I want him to be able to go to Mournhold and Solsthiem with me, and if possible to level up after awhile. He would need the companion share ability as well so I can give him armor and stuff that I find. How would I go about making him in the CS. I know how to add NPCs and give them armor, but I don't know how to add dialogue or do scripts.
Can anyone help me with this?
-------------------- 7-Zip Forever!
Home of the 8-bit theater
Intellectua- Join today
Post Extras:
|
baratheon79
|
Curate
|
|
|
Reged: 05/25/03
|
Posts: 853
|
Loc: NY, USA
|
|
|
This is actually fairly simple to do. Here is a sample script you might be able to work from, which is used by all the melee-type companions in my Mercenary Pack mod:
Code:
begin BAR_MP_MercScriptMelee
short Companion short levelup short c_level short c_athletics short c_strength short c_willpower short c_intelligence short c_agility short c_endurance short c_luck short c_health short c_magicka short c_fatigue short c_longblade short c_mediumarmor short c_heavyarmor short c_bluntweapon short c_axe short c_unarmored short c_block short c_sneak short c_speed short p_speed
float playerx float playery float playerz float warptimer
set playerx to ( Player->GetPos x ) set playery to ( Player->GetPos y ) set playerz to ( Player->GetPos z )
if ( menumode == 1 ) if ( GetPCSleep == 0 ) return endif endif
if ( GetPCSleep == 1 ) set levelup to 1 endif
set p_speed to ( Player->GetSpeed )
;Warp to player - Improves following ability
if ( GetCurrentAiPackage == 3 ) if ( GetWeaponDrawn == 1 ) elseif ( GetSpellReadied == 1 ) return elseif ( GetDistance Player > 800 ) set warptimer to warptimer + GetSecondsPassed if ( warptimer > 8 ) set warptimer to 0 SetPos x playerx SetPos y playery SetPos z playerz endif endif endif
;Levitation warping
if ( GetEffect, sEffectLevitate == 1 ) if ( GetWeaponDrawn == 1 ) elseif ( GetSpellReadied == 1 ) return elseif ( GetEffect, sEffectLevitate == 1 ) SetPos z playerz endif endif
;Companion will automatically cast levitation or water walking ;whenever the player does, while companion is is follow mode. ;Will dispel waterwalking effect if player stops using same effect.
if ( GetCurrentAIPackage == 3 ) if ( Player->GetEffect, sEffectLevitate == 1 ) if ( GetEffect, sEffectLevitate == 0 ) Cast, "_BAR_merc_levitate", Player endif endif if ( Player->GetEffect, sEffectWaterWalking == 1 ) if ( GetEffect, sEffectWaterWalking == 0 ) Cast, "_BAR_merc_waterwalk", Player endif endif if ( GetEffect, sEffectWaterWalking == 1 ) if ( Player->GetEffect, sEffectWaterWalking == 0 ) Cast, "_BAR_merc_dispel", Player endif endif endif
;Make companion fall with player when player's means of levitation expires ;Based on an original idea by "The Other Felix" and developed by Grumpy.
if ( Player->GetEffect, sEffectLevitate == 0 ) if ( GetEffect, sEffectLevitate == 1 ) SetPos z playerz endif endif
;This section causes the companion to automatically sneak or stop ;sneaking whenever the player does.
if ( GetCurrentAiPackage == 3 ) if ( Player->GetPCSneaking == 1 ) ForceSneak elseif ( Player->GetPCSneaking == 0 ) ClearForceSneak endif endif
;Decrease speed to a more reasonable level for wander/wait mode.
if ( GetCurrentAIPackage == 0 ) SetSpeed 40 endif
;Increase speed for follow mode to improve following ability.
if ( GetCurrentAIPackage == 3 ) set c_speed to ( p_speed + 100 ) SetSpeed, c_speed endif
;Automatic healing code. Mercenary will automatically heal him/herself ;if he/she drops below 50% health, if the mercenary has enough magicka ;to do so.
if ( GetMagicka > 30 ) ;Checks to be sure companion has enough magicka if ( GetHealthGetRatio <= 0.5) Cast, "_BAR_MP_healself", Player endif endif
;Level-up section. Will execute when mercenary is first hired, and whenever ;the player sleeps.
if ( levelup == 1 ) set c_level to ( Player->GetLevel )
;Set new values for the 6 main character attributes. ;Personality is ignored, as it is useless to an NPC.
set c_strength to (60 + (c_level * 2)) set c_willpower to (50 + (c_level * 1)) set c_intelligence to (30 + (c_level * 1)) set c_agility to (30 + (c_level * 1)) set c_endurance to (50 + (c_level * 1)) set c_luck to (40 + (c_level * 0.5))
;Set new values for relevant skills. Only those skills ;deemed important to the character are affected.
set c_longblade to (40 + (c_level * 1)) set c_axe to (30 + (c_level * 1)) set c_bluntweapon to (30 + (c_level * 1)) set c_mediumarmor to (45 + (c_level * 1.25)) set c_heavyarmor to (40 + (c_level * 1.5)) set c_unarmored to (20 + (c_level * 1)) set c_block to (5 +(c_level * 1)) set c_sneak to (5 + (c_level * 1.25)) set c_athletics to (5 + (c_level *1.25))
;This section enforces the 100-point cap ;for all stats and skills affected by this script.
if ( c_athletics > 100 ) set c_athletics to 100 endif if ( c_strength > 100 ) set c_strength to 100 endif if ( c_willpower > 100 ) set c_willpower to 100 endif if ( c_intelligence > 100 ) set c_strength to 100 endif if ( c_agility > 100 ) set c_agility to 100 endif if ( c_endurance > 100 ) set c_endurance to 100 endif if ( c_luck > 100 ) set c_luck to 100 endif if ( c_longblade > 100 ) set c_longblade to 100 endif if ( c_unarmored > 100 ) set c_unarmored to 100 endif if ( c_block > 100 ) set c_block to 100 endif if ( c_mediumarmor > 100 ) set c_mediumarmor to 100 endif if ( c_heavyarmor > 100 ) set c_heavyarmor to 100 endif if ( c_axe > 100 ) set c_axe to 100 endif if ( c_bluntweapon > 100 ) set c_bluntweapon to 100 endif if ( c_sneak > 100 ) set c_sneak to 100 endif
;Set health, magicka, and fatigue.
set c_health to (55 + (c_level * 9)) set c_magicka to (50 + (c_level * 2.25)) set c_fatigue to (150 + (c_level * 11))
SetAthletics, c_athletics SetStrength, c_strength SetAgility, c_agility SetIntelligence, c_intelligence SetWillpower, c_willpower SetEndurance, c_endurance SetLuck, c_luck SetLongblade, c_longblade SetUnarmored, c_unarmored SetBlock, c_block SetMediumarmor, c_mediumarmor SetHeavyarmor, c_heavyarmor SetBluntweapon, c_bluntweapon SetAxe, c_axe SetSneak, c_sneak SetHealth, c_health SetMagicka, c_magicka SetFatigue, c_fatigue
set levelup to 0 endif
end
This will provide all the basic functionality you want, including companion share, warping, even a level-up system, and even automatic healing. Note that all the spell IDs would need to be changed based on those that you will have to make and give to the companion in order to use those features. Also, you can change the numbers in the leveling section of the script to suit your personal taste. Feel free to experiment (just don't save while testing).
As for the dialog, that is probably most time-consuming part. I highly recommend that you take a look at the dialog for an existing companion mod, to see how it's done.
Hope this helps.
-------------------- My Morrowind Mods site and forums
Latest Release: Mercenary Pack Add-On 2: Guards
Post Extras:
|
DarkOneVenzar
|
Diviner
|
|
|
Reged: 11/04/03
|
Posts: 2774
|
Loc: Realm of Darkness
|
|
|
Thanks. Other then the spell name (ID) is there anything else there I need to change? The level up values look ok but the Current lvl * x might raise the skills a bit much won't it? I mean if the mercenary is level 20 and they lvl up won't that add 10 to their attributes causing them to become very powerful quickly?
-------------------- 7-Zip Forever!
Home of the 8-bit theater
Intellectua- Join today
Post Extras:
|
baratheon79
|
Curate
|
|
|
Reged: 05/25/03
|
Posts: 853
|
Loc: NY, USA
|
|
|
It depends on the number you multiply the c_level variable by. In the case of that particular script, stats won't start to max until around level 20. Actually to be completely honest, in some instances the melee characters using this script can be a bit underpowered.
And yes, the spell IDs are really all you absolutely need to change. If they don't the IDs of the spells you give to the NPC, you'll end up with a bunch of errors. The names of all those variables are pretty much the same in all my mods, but they don't conflict, because of the scripts being local.
Oh, and one more thing I should mention, with regard to variables. You could have a problem if you use alot of variables. If you need more variables, for example to control more of the character's stats in the leveling portion of the script, the 34th variable you declare needs to be a dummy variable. In other words, it has to be something you won't use in the script.
For example, from the main script for my newly released Companion Arya: Code:
short Companion short c_levelup short AIPackage
float playerx float playery float playerz float warptimer
float mhealth float chealth float P_mhealth float P_chealth float p_speed float c_speed
short c_level short c_athletics short c_strength short c_willpower short c_intelligence short c_agility short c_endurance short c_luck short c_health short c_magicka short c_fatigue
short c_shortblade short c_unarmored short c_block short c_restoration short c_spear short c_lightarmor short c_marksman short c_security short c_sneak short DoNotUse short c_mediumarmor short c_heavyarmor short c_longblade
float dispel_timer
short NoLore Note that the 34th variable is named DoNotUse. This variable is not used anywhere in the script, but it has to be there, in order for the thing to work properly. Otherwise, the game will basically disregard a variable that is supposed to be used.
-------------------- My Morrowind Mods site and forums
Latest Release: Mercenary Pack Add-On 2: Guards
Post Extras:
|
DarkOneVenzar
|
Diviner
|
|
|
Reged: 11/04/03
|
Posts: 2774
|
Loc: Realm of Darkness
|
|
|
I think I am going to leave that as it is and just change the multipliers for the skills. Maybe to 2. Or does the game recognize 1.75? I already have ideas for my spell names so no worries there.
-------------------- 7-Zip Forever!
Home of the 8-bit theater
Intellectua- Join today
Post Extras:
|
baratheon79
|
Curate
|
|
|
Reged: 05/25/03
|
Posts: 853
|
Loc: NY, USA
|
|
|
1.75 should be fine, I imagine. Best bet is to experiment with it using several different saves at various points of the game. The basic idea is for the companion to be tough enough so you don't have to be constantly watching his/her health, but not so tough that he/she can wipe out everything in Dagoth Ur's fortress while you stand back and watch without lifting a finger.
-------------------- My Morrowind Mods site and forums
Latest Release: Mercenary Pack Add-On 2: Guards
Post Extras:
|
DarkOneVenzar
|
Diviner
|
|
|
Reged: 11/04/03
|
Posts: 2774
|
Loc: Realm of Darkness
|
|
|
Well for now that is not the case the one I have has been killed before mainly because it got in my way and got killed. I only have one save right now, and I am just trying to get my guy powerful enough as it is right now. So I want it to be able to defend me if needbe but not take all the kills.
-------------------- 7-Zip Forever!
Home of the 8-bit theater
Intellectua- Join today
Post Extras:
|
Zappara
|
Adept
|
|
|
Reged: 08/15/03
|
Posts: 272
|
Loc: Lost Dwemer city
|
|
|
There's a mistake in the script:
Code:
if ( c_intelligence > 100 ) set c_strength to 100 endif I had that mercenary pack installed (v3.5) when I started to make my own companions and when I checked its scripts in the editor I found other similar bugs as mentioned above.
I changed the companion's healing code so that they can use health potions if player have given those potions to them:
Code:
if ( GetHealthGetRatio <= 0.5) if ( GetEffect, sEffectRestoreHealth == 0 ) if ( GetMagicka > 30 ) ;Checks to be sure companion has enough magicka Cast, "_zap_guard_healself", Player elseif ( GetItemCount "p_restore_health_b" => 1 ) Equip "p_restore_health_b" Playsound "Drink" elseif ( GetItemCount "p_restore_health_c" => 1 ) Equip "p_restore_health_c" Playsound "Drink" elseif ( GetItemCount "p_restore_health_s" => 1 ) Equip "p_restore_health_s" Playsound "Drink" elseif ( GetItemCount "p_restore_health_q" => 1 ) Equip "p_restore_health_q" Playsound "Drink" elseif ( GetItemCount "p_restore_health_e" => 1 ) Equip "p_restore_health_e" Playsound "Drink" endif endif endif
-------------------- [WIP] Tombs Expanded
Disturb the Dead 3.31
Isle of Thumzand: Nerevarine's Castle 0.9beta
+ other mods
My Morrowind plugin pages
Post Extras:
|
DarkOneVenzar
|
Diviner
|
|
|
Reged: 11/04/03
|
Posts: 2774
|
Loc: Realm of Darkness
|
|
|
Zappara what is the error there? Also where do I put the script for using the healing potions? Where would it go in the above mention full script?
-------------------- 7-Zip Forever!
Home of the 8-bit theater
Intellectua- Join today
Post Extras:
|
Zappara
|
Adept
|
|
|
Reged: 08/15/03
|
Posts: 272
|
Loc: Lost Dwemer city
|
|
|
Quote:
There's a mistake in the script:
Code:
if ( c_intelligence > 100 ) set c_strength to 100 endif
There should read: set c_intelligence to 100
Replace this:
Quote:
Code:
if ( GetMagicka > 30 ) ;Checks to be sure companion has enough magicka if ( GetHealthGetRatio <= 0.5) Cast, "_BAR_MP_healself", Player endif endif
with the healing script code I provided in the earlier message. Remember to change my spell ID to your own spell ID.
-------------------- [WIP] Tombs Expanded
Disturb the Dead 3.31
Isle of Thumzand: Nerevarine's Castle 0.9beta
+ other mods
My Morrowind plugin pages
Post Extras:
|